package com.fer.tankr.models.obstacles;

import org.andengine.entity.shape.IAreaShape;
import org.andengine.extension.physics.box2d.PhysicsFactory;
import org.andengine.extension.physics.box2d.PhysicsWorld;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.fer.andenginemvc.api.gameObjects.GameObject;

public class Crate extends GameObject<IAreaShape> {

	
	public Crate(PhysicsWorld world, VertexBufferObjectManager vbom,
			float x, float y, float width, float height, ITextureRegion texture) {
		super(world, vbom, getSprite(width, height, texture, x, y, vbom));
		
	}



	@Override
	public Body initBody() {
		Body boxBody =  PhysicsFactory.createBoxBody(physWorld, entity, BodyType.DynamicBody, fixtureDef);
		boxBody.setLinearDamping(10);
		boxBody.setAngularDamping(10);
		boxBody.setAwake(false);
		return boxBody;
	}

	@Override
	public FixtureDef initFixtureDef() {
		return PhysicsFactory.createFixtureDef(0.1f, 0.5f, 0.5f);
	}


}
